{include file="public/header" /}
<form class="layui-form">
	<div class="layui-form-item">
		<label class="layui-form-label">部门名称</label>
		<div class="layui-input-block">
			<input type="text" class="layui-input" name="group_name" placeholder="请输入部门名称">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">状态</label>
		<div class="layui-input-block">
			<input type="radio" name="status" value="1" title="开启" checked="">
			<input type="radio" name="status" value="0" title="禁用">
		</div>
	</div>
	<div class="layui-form-itme">
		<label class="layui-form-label">权限菜单</label>
		{volist name="menus" id="vo"}
		<hr>
		<div class="layui-input-block">
			<input type="checkbox" name="menu[{$vo.smid}]" lay-skin="primary" title="{$vo.label}">
			<hr>
			{volist name="vo.children" id="cvo"}
				<input type="checkbox" name="menu[{$cvo.smid}]" lay-skin="primary" title="{$cvo.label}">
			{/volist}
		</div>
		{/volist}
	</div>
</form>
<div class="layui-form-item" style="margin-top:10px;">
	<div class="layui-input-block">
		<button type="button" class="layui-btn" onclick="save()">保存</button>
	</div>
</div>
<script type="text/javascript">
	layui.use(['layer','form'],function(){
		var form = layui.form;
		layer = layui.layer;
		$ = layui.jquery;
	});

	function save(){
		$.post("{$config['admin_route']}bewadmin/groupadd",$('form').serialize(),function(res){
			if(res.code>0){
				layer.msg(res.msg,{'icon':2});
			}else{
				layer.msg(res.msg,{'icon':1});
				setTimeout(function(){parent.window.location.reload();},1000);
			}
		},'json');
	}
</script>
{include file="public/tail" /}